package com.hjn.study.prototype;


import lombok.Data;
import lombok.ToString;

@Data
@ToString
public class User implements Cloneable {
    private String name;
    private String age;
    static User user = null;

    private User(){
        this.age = "21";
        this.name = "hjn1";
    }

    @Override
    protected User clone() throws CloneNotSupportedException {
        return (User)super.clone();
    }

    public static User getUser() throws CloneNotSupportedException {
        if (user == null){
            user = new User();
            return user.clone();
        }else {
            return user.clone();
        }
    }
}
